/*
    BFS增广出所有的变长为4的路径(可形成环);
*/
#include <bits/stdc++.h>
using namespace std;
const int N = 10000 + 5;
struct Node
{
    int root, paths[4], len;
};
vector<int> G[N];
int bfs(int n)
{
    queue<Node> Q;
    int ans = 0;
    // 初始化初始状态
    for(int i = 1; i <= n; ++i)
    {
        Node node;
        node.root = i;
        node.len = 1;
        node.paths[0] = i;
        Q.push(node);
    }
    
    while(!Q.empty())
    {
        Node node = Q.front(); Q.pop();
        
        // 邻接点
        int cur = node.paths[node.len - 1];     // 路径上的最后一个顶点
        // cout << cur << " : ";
        for(int i = 0; i < G[cur].size(); ++i)
        {
            // cout << G[cur][i];
            int u = G[cur][i];
            if(node.len == 3 && u == node.paths[1]) continue;
            if(node.len == 2 && u == node.paths[0]) continue;

            if(node.len == 3) ans+=1;
            else
            {
                Node nnode = node;
                memcpy(nnode.paths, node.paths, sizeof(node.paths));
                nnode.len += 1;
                nnode.paths[nnode.len - 1] = u;      
                Q.push(nnode);
            } 
        }
        // cout << endl;
    }
    return ans;
}
int main()
{
#ifdef LOCAL
    freopen("PREV-13.in", "r", stdin);
#endif
    int n, m, u, v;
    cin >> n >> m;
    for(int i = 1; i <= m; ++i)
    {
        cin >> u >> v; 
        G[u].push_back(v);
        G[v].push_back(u);
    }
    int ans = bfs(n);
    cout << ans << endl;    
    return 0;
}